import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
// 需要左方向动画的路由用this.$router.to('****')
Router.prototype.togo = function (path) {
  this.isleft = true
  this.isright = false
  this.push(path)
}
// 需要右方向动画的路由用this.$router.goRight('****')
Router.prototype.goRight = function (path) {
  this.isright = true
  this.isleft = false
  this.push(path)
}
// 需要返回按钮动画的路由用this.$router.goBack()，返回上一个路由
Router.prototype.goBack = function () {
  this.isright = false
  this.isleft = true
  this.go(-1)
}
// 点击浏览器返回按钮执行，此时不需要路由回退
Router.prototype.togoback = function () {
  this.isright = false
  this.isleft = true
}
// 点击浏览器前进按钮执行
Router.prototype.togoin = function () {
  this.isright = true
  this.isleft = false
}
// window.addEventListener('popstate', function (e) {
//   router.isBack = true
// }, false)
export default new Router({

	routes: [{
			path: '/',
			name: 'index',
			component: (resolve) => require(['@/pages/index'], resolve),
			redirect: '/home',

			children: [{
					path: '/home',
					name: 'home',
					component: (resolve) => require(['@/pages/index/home'], resolve),
					mode: "history"
				},
				{
					path: '/wenBrigade',
					name: 'wenBrigade',
					component: (resolve) => require(['@/pages/index/webBrigade'], resolve)
				},
				{
					path: '/region',
					name: 'region',
					component: (resolve) => require(['@/pages/index/region'], resolve)
				},
				{
					path: '/my',
					name: 'my',
					component: (resolve) => require(['@/pages/index/my'], resolve)
				}
			]
		},

		{ //详情页
			path: '/Home/Detail',
			name: 'Detail',
			component: (resolve) => require(['@/pages/detail'], resolve)
		},

		{ //资讯详情页
			path: '/information',
			name: 'information',
			component: (resolve) => require(['@/pages/index/home/entrance1/information'], resolve)
		},
		{ //特产
			path: '/specialty',
			name: 'specialty',
			component: (resolve) => require(['@/pages/index/home/specialty'], resolve)
		},
		{ //菌库
			path: '/bacteriaBank',
			name: 'bacteriaBank',
			component: (resolve) => require(['@/pages/index/home/bacteriaBank'], resolve)
		},
		{ //非遗
			path: '/intangibleHeritage',
			name: 'intangibleHeritage',
			component: (resolve) => require(['@/pages/index/home/intangibleHeritage'], resolve)
		},
		{ //商城
			path: '/shoppingMall',
			name: 'shoppingMall',
			component: (resolve) => require(['@/pages/index/home/shoppingMall'], resolve)
		},
		{ //新闻详情页
			path: '/news',
			name: 'news',
			component: (resolve) => require(['@/pages/index/home/news'], resolve)
		},
		{ //视频页
			path: '/dplayer',
			name: 'dplayer',
			component: (resolve) => require(['@/pages/index/home/entrance1/dplayer'], resolve)
		},
		{ //视频
			path: '/myplayer',
			name: 'myplayer',
			component: (resolve) => require(['@/components/myplayer'], resolve)
		},
		{ //非遗图库
			path: '/gallery',
			name: 'gallery',
			component: (resolve) => require(['@/pages/index/home/gallery'], resolve)
		},

		{ //图片查看页面
			path: '/picBank',
			name: 'picBank',
			component: (resolve) => require(['@/pages/index/detailsPage/picBank'], resolve)
		},
		{ //专题详情页
			path: '/special',
			name: 'special',
			component: (resolve) => require(['@/pages/index/home/entrance3/special'], resolve)
		},

		//地产主页
		{
			path: '/realEstate',
			name: 'realEstate',
			component: (resolve) => require(['@/pages/index/webBrigade/realEstate'], resolve)
		},
		//地产详情页
		{
			path: '/propertyDetails',
			name: 'propertyDetails',
			component: (resolve) => require(['@/pages/index/webBrigade/propertyDetails'], resolve)
		},
		//空气指数页
		{
			path: '/airIndex',
			name: 'airIndex',
			component: (resolve) => require(['@/pages/index/webBrigade/airIndex'], resolve)
		},
		//美食特产
		{
			path: '/deliciousFood',
			name: 'deliciousFood',
			component: (resolve) => require(['@/pages/index/region/deliciousFood'], resolve)
		},
		//本地房价
		{
			path: '/localHousingprices',
			name: 'localHousingprices',
			component: (resolve) => require(['@/pages/index/region/localHousingprices'], resolve)
		},
		//大理出行
		{
			path: '/localTrip',
			name: 'localTrip',
			component: (resolve) => require(['@/pages/index/region/localTrip'], resolve)
		},
		//文旅地产
		{
			path: '/rea',
			name: 'rea',
			component: (resolve) => require(['@/pages/index/region/rea'], resolve)
		},
		//文旅地产
		{
			path: '/scenicSpot',
			name: 'scenicSpot',
			component: (resolve) => require(['@/pages/index/region/scenicSpot'], resolve)
		},
		//本地特产
		{
			path: '/spec',
			name: 'spec',
			component: (resolve) => require(['@/pages/index/region/spec'], resolve)
		},

		//个人中心
		//个人设置
		{
			path: '/login',
			name: 'login',
			component: (resolve) => require(['@/pages/index/memberCenter/login'], resolve)
		},
		{
			path: '/memberSetting',
			name: 'memberSetting',
			component: (resolve) => require(['@/pages/index/memberCenter/memberSetting'], resolve)
		},
		//我的收藏
		{
			path: '/myCollection',
			name: 'myCollection',
			component: (resolve) => require(['@/pages/index/memberCenter/myCollection'], resolve)
		},
		//我的足迹
		{
			path: '/myTracks',
			name: 'myTracks',
			component: (resolve) => require(['@/pages/index/memberCenter/myTracks'], resolve)
		},
		//推送消息
		{
			path: '/pushMessage',
			name: 'pushMessage',
			component: (resolve) => require(['@/pages/index/memberCenter/pushMessage'], resolve)
		},
		//设置
		{
			path: '/setting',
			name: 'setting',
			component: (resolve) => require(['@/pages/index/memberCenter/setting'], resolve)
		},

		//搜索页
		{
			path: '/search',
			name: 'search',
			component: (resolve) => require(['@/pages/index/home/search'], resolve)
		},
	],
	mode: "history" //去掉#号
})